﻿using CommunityToolkit.Mvvm.ComponentModel;

namespace Company.Shell.Models
{
    /// <summary>
    /// 表示PLC的一个寄存器点位的值等相关信息
    /// </summary>
    public class PlcValue : ObservableObject
    {
        private PlcValue() { }
        public PlcValue(int id)
        {
            Id = id;
        }
        private int id;
        /// <summary>
        /// 点位编号（0-99）
        /// </summary>
        public int Id
        {
            get { return id; }
            set { SetProperty(ref id, value); }
        }
        private short address = -1;
        /// <summary>
        /// 当前寄存器的地址号
        /// </summary>
        public short Address
        {
            get { return address; }
            set { SetProperty(ref address, value); }
        }
        private double _value = -1;
        /// <summary>
        /// 当前值，除了10的结果
        /// </summary>
        public double Value
        {
            get { return _value; }
            set { SetProperty(ref _value, value); }
        }

        private ushort originValue;
        /// <summary>
        /// 原始值
        /// </summary>
        public ushort OriginValue
        {
            get { return originValue; }
            set { SetProperty(ref originValue, value); }
        }
    }
}
